﻿using Flow.Manage.Contracts;
using Framework.Cache;
using Framework.Models.Entities;
using Framework.Models.Request;
using Microsoft.AspNetCore.Mvc;

namespace ApprovalFlow.Api.Controllers
{
    [ApiController]
    public class UserController : ControllerBase
    {
        private readonly ILogger<UserController> _logger;

        private readonly IServiceProvider _provider;

        public UserController(ILogger<UserController> logger, IServiceProvider provider)
        {
            _logger = logger;
            _provider = provider;
        }

        private IAccountContract _accountContract => GlobalConfig.ServiceProvider.GetRequiredService<IAccountContract>();

        [HttpPost]
        [Route("api/User/AddUser")]
        public IActionResult AddUser([FromBody] Biz_UserRequest request)
        {
            var result = _accountContract.AddUser(request); 
            return Ok(result);
        }
    }
}